package day0812.xingyeshuke;

import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        char[] charNum = (num+"").toCharArray();
        String text ="";
        for (int i = 0; i <charNum.length ; i++) {
            int x =(charNum[i]-'0'+5) %10;
            text+=x;
        }
        char[] ans = text.toCharArray();
        for (int i = 0; i < ans.length/2; i++) {
            char temp = ans[i];
            ans[i] = ans[ans.length-i-1];
            ans[ans.length-i-1] = temp;
        }
        for (int i = 0; i <ans.length ; i++) {
            System.out.print(ans[i]);
        }
    }
}
